using DalatCooking.Core.Helper;
using System;
namespace DalatCooking.Core
{
    public class Setting
    {
        public int SettingId { get; set; }
        public string Name { get; set; }
        public string Value { get; set; }
        public int ApplicationId { get; set; }
        public static void SetValue(string settingName, string settingValue)
        {
            Setting s = new Setting { Name = settingName, Value = settingValue };
            bool rs = SettingManager.Update(s);
            // return rs;
        }
        static string GetValue(string name)
        {
            Setting s = SettingManager.FindByName(name);
            if (s != null)
                return s.Value;
            return string.Empty;
        }
        public static string String(string name)
        {
            return GetValue(name);
        }
        public static int Int(string name)
        {
            return ConvertObject.ToInt(GetValue(name));
        }
        public static bool Boolean(string name)
        {
            return ConvertObject.ToBool(GetValue(name));
        }
    }
}